//
//  SDPhotoListData.m
//  SKinDiary
//
//  Created by pcyang on 16/8/22.
//  Copyright © 2016年 tencent. All rights reserved.
//

#import "SDPhotoListData.h"
#import "SDPhotoInfo.h"

@implementation SDPhotoListData

-(NSString*)getRequestUrl
{

//   return [NSString stringWithFormat:@"http://121.41.53.41:8877/photo?page=%d",_pageNum];
     return [NSString stringWithFormat:@"%@/photo?page=%d",[[SDServerSwitchManager sharedInstance] getServerUrl],_pageNum];
}

- (id)resetWithResponseModel:(id)data
{
    if (_photoList == nil) {
        _photoList = [[NSMutableArray alloc] init];
    }
    if([data isKindOfClass:[NSDictionary class]])
    {
        NSArray* tmpList = [SDPhotoInfo modelsWithInfos:[data objectForKey:@"photos"]];
        _pageOver = NO;
        if (CHECK_VALID_ARRAY(tmpList)) {
            [_photoList addObjectsFromArray:tmpList];
            _pageNum++;
        } else {
            _pageOver = YES;
        }
    }
    
    return data;
}
@end
